﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using Com.Library.Page;
using Com.Library.Cookie;

namespace Com.Web.coffinegurunaru.AppLogic.Page
{
    public class ManagerMasterPage : WebMasterPage
    {
        public new ManagerPage WebPage
        {
            get
            {
                if (this.Page != null)
                {
                    if (this.Page is ManagerPage)
                        return (ManagerPage)this.Page;
                    else
                        return null;
                }
                return null;
            }
        }

        private ManagerCookie m_WebCookie = null;
        public new ManagerCookie WebCookies
        {
            get
            {
                if (m_WebCookie == null)
                {
                    m_WebCookie = new ManagerCookie();
                }

                return m_WebCookie;
            }
        }

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            if (!this.WebCookies.IsLogin)
            {
               Response.Redirect("/manager/login.aspx?redirect=" + Server.UrlEncode(Request.Url.ToString()));
            }
        }
    }
}
